package com.haiwen.boot.controller;

import com.haiwen.boot.pojo.User;
import com.haiwen.boot.service.LoginAndRegisterService;
import com.haiwen.boot.vo.ResultMap;
import com.sun.istack.internal.NotNull;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Api(tags = "注册Api")
public class registerController {
    @Autowired
    private LoginAndRegisterService loginAndRegisterService;
    //简单注册
    @PostMapping(value = "/register")
    @ApiOperation(value = "注册接口")
    public Map<String,Object> register(@RequestParam String username,
                                       @RequestParam String password,
                                       String VerificationCode){
      return loginAndRegisterService.Register(username,password,VerificationCode);
    }
    @PostMapping(value = "/verificationCode")
    @ApiOperation(value = "发送验证码")
    public ResultMap VerificationCode(@RequestParam String recieverName,
                                      @RequestParam String recieverEmailAddress){
        return loginAndRegisterService.VerificationCode(recieverName,recieverEmailAddress);
    }
}
